﻿
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Drawing;
using System.Globalization;
using System.IO;
using System.Runtime.CompilerServices;
using System.Threading;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Forms;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Threading;
using System.Linq;
using System.Runtime.InteropServices;
using System.Security;
using System.Security.Permissions;
using System.Reflection;
using System.Windows.Interop;
using MessageBox = System.Windows.MessageBox;
using CosAging.View;
using System.Diagnostics.Tracing;
using NPOI.SS.Formula.Functions;
using System.Net;
using Label = System.Windows.Controls.Label;
using System.ServiceModel.Channels;
using Binding = System.Windows.Data.Binding;
using System.Collections.Concurrent;
using NPOI.OpenXmlFormats.Dml.Diagram;
using Google.Protobuf.WellKnownTypes;
using NPOI.Util;
using static System.Windows.Forms.VisualStyles.VisualStyleElement.Tab;
using System.Threading.Tasks;
using System.Windows.Documents;
using System.Data;
using Org.BouncyCastle.Utilities;
using MySqlX.XDevAPI.Common;
using System.Timers;

namespace CosAging
{
    /// <summary>
    /// Window1.xaml 的交互逻辑
    /// </summary>
    public partial class WindowWarning : Window
    {
        DispatcherTimer DTime = new DispatcherTimer();
        int WaitSecond = 3;
        public WindowWarning()
        {
            //PublicClass.计时起点();
            InitializeComponent();
            Class_Initialize();
            //PublicClass.计时终点();
            //PublicClass.Logger.Info(PublicClass.时间差);
        }
        private void Class_Initialize()
        {
            DTime.Tick += Dptimer_Tick;    //定时器在某个时间内执行的事件
            DTime.Interval = TimeSpan.FromMilliseconds(1000);  //定时器，定时间隔为多少毫秒  ，可以通过TimeSpan来改变
            DTime.Start();



        }

        private void Dptimer_Tick(object sender, EventArgs e)
        {
   
            WaitSecond--;
            倒计时框.Text= "我已确认，QBH出光侧除老化靶激光功率计外没有人员和其他物品"+ "("+WaitSecond.ToString()+"秒"+ ")";
            if (WaitSecond==0)
            {
                环境确认.IsEnabled= true;
                DTime.Stop();
            }
        }

        public void Win_Loaded(object sender, RoutedEventArgs e)
        {

        }


        private void mainform_FormClosing(object sender, CancelEventArgs e)
        {
            
        }

        private void MainWindows_Keydown(object sender, System.Windows.Input.KeyEventArgs e)
        {
            //PublicClass.KeyboardandShutdown(sender, e);
        }

     

        private void 继续操作_Click(object sender, RoutedEventArgs e)
        {
            if(环境确认.IsChecked==true)
            {
                MainWindow.是否继续操作 = true;
                this.Close();    
            }
            else
            {
                MessageBox.Show("请先确认QBH周围环境，并勾选");
            }
        }

        private void 取消操作_Click(object sender, RoutedEventArgs e)
        {

           MainWindow.是否继续操作 = false;
           this.Close();
        }
    }
    }

